<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<div th:replace="themes/default/header::header(title='文章归档',keywords=null)"></div>
<link th:href="@{/bootstrap/3.3.7/css/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
<link th:href="@{/font-awesome/4.7.0/css/font-awesome.min.css}" rel="stylesheet"/>
<style type="text/css">
    body{
        font-family: -apple-system, SF UI Text, Arial, PingFang SC, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, sans-serif!important;
    }
    .m-b-10 {
        margin-bottom: 10px;
    }
    .navbar-menu a {
        /*font-weight: bold;*/
    }
</style>

<body>
<div class="main-content archive-page clearfix" style="margin: 0 auto;max-width: 80%;">
    <div id="wrapper">
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <h3 class="page-title">归档管理</h3>
                </div>
                <div class="col-md-6">
                    <div class="panel panel-color panel-primary">
                        <div class="panel-heading">
                            <h1 class="panel-title">分类列表</h1>
                        </div>
                        <div class="panel-body">
                            <th:block th:each="c : ${categories}">
                                <div class="btn-group m-b-10">
                                    <th:block th:if="${c.name == '默认分类'}">
                                        <button type="button"
                                                th:class="'btn btn-'+${adminCommons.rand_color()}+' waves-effect waves-light'"
                                                th:onclick="'javascript:archivesList(\''+${c.name}+'\',\''+${c.type}+'\');'" >
                                            <th:block th:text="${c.name}"/>
                                            <th:block th:text="' ('+${c.count}+')'"/>
                                        </button>
                                    </th:block>
                                    <th:block th:unless="${c.name == '默认分类'}">
                                        <button type="button"
                                                th:class="'btn btn-'+${adminCommons.rand_color()}+' dropdown-toggle waves-effect waves-light'"
                                                data-toggle="dropdown" aria-expanded="false"
                                                th:onclick="'javascript:archivesList(\''+${c.name}+'\',\''+${c.type}+'\');'" >
                                            <th:block th:text="${c.name}"/>
                                            <th:block th:text="' ('+${c.count}+')'"/>
                                            </button>
                                    </th:block>
                                </div>
                            </th:block>
                        </div>
                    </div>
                </div>

                <div class="col-md-6">
                    <div class="panel panel-color panel-primary">
                        <div class="panel-heading">
                            <h1 class="panel-title">标签列表</h1>
                        </div>
                        <div class="panel-body">
                            <th:block th:each="c : ${tags}">
                                <div class="btn-group m-b-10">
                                    <button type="button"
                                            th:class="'btn btn-'+${adminCommons.rand_color()}+' dropdown-toggle waves-effect waves-light'"
                                            data-toggle="dropdown" aria-expanded="false"
                                            th:onclick="'javascript:archivesList(\''+${c.name}+'\',\''+${c.type}+'\');'" >
                                        <th:block th:text="${c.name}"/>
                                        <th:block th:text="' ('+${c.count}+')'"/>
                                        </button>
                                </div>
                            </th:block>
                        </div>
                    </div>
                </div>

                <!--<div class="col-md-12">-->
                    <!--<div class="panel panel-color panel-primary">-->
                        <!--<div class="panel-heading">-->
                            <!--<h1 class="panel-title">查询结果列表</h1>-->
                        <!--</div>-->
                        <!--<div class="panel-body">-->
                            <!--<table class="table table-striped table-bordered query-list-container">-->
                                <!--<thead>-->
                                <!--<tr>-->
                                    <!--<th width="50%">文章标题</th>-->
                                    <!--<th width="15%">发布时间</th>-->
                                    <!--<th>浏览量</th>-->
                                    <!--<th>所属分类</th>-->
                                    <!--<th width="8%">发布状态</th>-->
                                <!--</tr>-->
                                <!--</thead>-->
                                <!--<tbody class="query-list">-->


                                <!--</tbody>-->
                            <!--</table>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
            </div>
        </div>
    </div>
</div>
</body>
<div th:replace="themes/default/footer::footer"></div>
<script th:src="@{/jquery/2.2.3/jquery.min.js}"></script>

<script th:src="@{/admin/js/base.js}"></script>
<script th:src="@{/admin/js/baseContextPath.js}"></script>
<script th:src="@{/bootstrap/3.3.7/js/bootstrap.min.js}"></script>
<!--<script type="application/javascript">-->

<script type="application/javascript">
    /*<![CDATA[*/
    //var tale = new $.tale();

    function archivesList(name,type) {
        //alert(name);
        //alert(type);
        if (name!='' && type != '') {
//            tale.post({
//                url: getContextPath() + '/archivesList',
//                data: {name: name, type: type},
//                success: function (result) {
//                    if (result && result.success) {
//                        //tale.alertOkAndReload('获取归档列表成功');
//                        //alert("获取归档列表成功");
//                        var array = result.payload;
//                        //alert(array.length);
//
//                        if (array.length > 0){
//                            // TODO
//                            addListToPage(array);
//                        }
//
//                    } else {
//                        //tale.alertError(result.msg || '获取归档列表失败');
//                        alert("获取归档列表失败");
//                    }
//                }
//            });

            window.location.href = getContextPath() + '/archivesList?name='+name+"&type="+type;
        }
    };

    /*function addListToPage(array){
        $(".query-list").remove();

        var tbody = "<tbody class='query-list'></tbody>";
        $(".query-list-container").append(tbody);

        //var content = $("#thymeleafTableBody").html(array);

        //alert(JSON.stringify(content));
        $(".query-list-container tbody").html($("#thymeleafTableBody").html(array));
    };*/

    /*]]>*/

</script>


</html>